﻿<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/common/taglibs.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>机构-人员总数</title>
    <!--common-->
   <link rel="stylesheet" href="/resources/src/css/lib/bootstrap.min.css">
		<link rel="stylesheet" href="/resources/src/css/admin/main.css" />
		<link rel="stylesheet" href="/resources/src/css/admin/user-manage.css" />
</head>
<body>
    
   <article class="main">
			<div class="main-wrapper">
				<section class="content">
				<form id="myForm" action="/admin/agency/${fatherId }/agencyMember">
					<div class="container">
						<div class="con-body">
							<div class="toolbar clearfix">
								<div class="toolbar-left toolbar-one pull-left">
									<a href="#" id="checkout" class="pull-left">导出</a>
								</div>
								<input type="hidden" id="fatherId" value="${fatherId }"/>
								<div class="toolbar-right pull-left">
									<div class="input-icon">
										<input type="text" id="search" placeholder="输入用户名/手机/邮箱查询"/>
										<i class="iconfont icon-sousuo" id="search-btn"></i>
									</div>
								</div>
							</div>
							<div class="user-table table-responsive">
								<table class="table">
									<thead>
										<tr>
											<th>姓名</th>
											<th>联系手机</th>
											<th>联系邮箱</th>
											<th>用户角色</th>
											<th>操作</th>
										</tr>
									</thead>
									<tbody id="mytable">
									 <c:forEach items="${pages.result }" var="page">
										<tr data-userId="255">
											<td><a href="#">${page.user.userName }</a></td>
											<td>${page.user.phone }</td>
											<td>${page.user.email }</td>
											<td>${page.user.userRole.role.name } </td>
											<td><a href="/admin/user/edit/${page.user.id }">修改</a></td>
										</tr>
									</c:forEach>
									<tr>
										<td colspan="5"  style="border:0"><jsp:include page="/common/adminPage.jsp" /></td>
										</tr>
									</tbody>
								</table>		
							</div>
						</div>
					</div>
					</form>
				</section>
			</div>
		</article>
    
     <script src="/resources/src/js/jquery-2.1.4.js"></script>
	 <script src="/resources/src/js/jquery.nicescroll.js"></script>
	 <script src="/resources/src/js/admin/main.js"></script>
     <script src="/resources/src/js/adminPage.js"></script>
     <script>
			$(function(){
				document.onkeydown = function(e){ 
	        	    var ev = document.all ? window.event : e;
	        	    if(ev.keyCode==13) {
	        	    	var value=$("#search").val().trim();
				 		var fatherId=$("#fatherId").val().trim();
				 		if(value!="" && value!=null){
				 			$.ajax({
				 				type:"post",
				 				url:"/admin/agency/"+fatherId+"/agencyMember",
				 				async:true,
				 				data:{"condition":value},
				 				success:function(data){
				 					$("#mytable").html(data);
				 				}
				 			});
				 		}
	        	     }
	        	}
				
				//搜索
			 	$("#search-btn").on("click",function(){
			 		var value=$("#search").val().trim();
			 		var fatherId=$("#fatherId").val().trim();
			 		if(value!="" && value!=null){
			 			$.ajax({
			 				type:"post",
			 				url:"/admin/agency/"+fatherId+"/agencyMember",
			 				async:true,
			 				data:{"condition":value},
			 				success:function(data){
			 					$("#mytable").html(data);
			 				}
			 			});
			 		}
			 	});
			})
		</script>
</body>
</html>